using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using FactoryPattern.Domain;

namespace FactoryPattern.Factories
{
    public abstract class SuitFactoryInheritance
    {
        private ArrayList _loaded = new ArrayList();
        public abstract void LoadSuits();

        public SuitFactoryInheritance()
        {
            LoadSuits();
        }

        public Suit GetSuit(SuitType suitType)
        {
            Suit suit = null;
            foreach (Suit obj in _loaded)
            {
                if (obj.TypeOfSuit == suitType)
                {
                    suit = obj;
                    break;
                }
            }
            return suit;
        }

        protected void AddSuit(Suit suit)
        {
            _loaded.Add(suit);
        }
    }

    public class BusinessSuitFactory : SuitFactoryInheritance
    {
        public override void LoadSuits()
        {
            this.AddSuit(new PlaidBusinessSuit());
            this.AddSuit(new StripedBusinessSuit());
            this.AddSuit(new Armani());
        }
    }

    public class LeisureSuitFactory : SuitFactoryInheritance
    {
        public override void LoadSuits()
        {
            this.AddSuit(new GolfSuit());
            this.AddSuit(new TennisSuit());
        }
    }
}